You are here: Symbol Reference > Dew Namespace > Dew.Math Namespace > Dew.Math.Units Namespace > Classes > MtxIntDiff Class > MtxIntDiff Methods > MtxIntDiff.WeightsNewtonCotes Method
Dew Math for .NET
ContentsIndexHome
PreviousUpNext
MtxIntDiff.WeightsNewtonCotes Method

Newton-Cotes base points and weights.

Syntax
C#
Visual Basic
public static void WeightsNewtonCotes(int PolyOrder, [In] TVec Points, [In] TVec Weights, [In] TMtxFloatPrecision FloatPrecision);
Parameters 
Description 
int PolyOrder 
Defines the interpolating polynomial order. 
[In] TVec Points 
Returns base points coordinate. 
[In] TVec Weights 
Returns weights. 
[In] TMtxFloatPrecision FloatPrecision 
Specifies the precision of the weights to be returned. 

Uses the Newton-Cotes formulas to calculate base points and weights for numerical integration. Check the following link to learn more about Newton-Cotes formulas.

Use Simpson rule to evaluate sin(x) on interval [0,PI]. 

 

// Integrating function private double IntFunc(TVec Parameters, TVec c, params object[] o) { double x = Parameters[0]; return System.Math.Sin(x); } // Integrate private void DoIntegrate() { Vector bpoints = new Vector(0); Vector weights = new Vector(0); MtxIntDiff.WeightsNewtonCotes(2,bpoints,weights); // 2 means Simpson double area = QuadGauss(IntFunc,0,System.Math.PI,bpoints,weights,1); }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!